home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / FILER / GZIP1_2_.SPK / src_zip_gz / src / zip / other / SH-scripts / zmore.in < prev    next >
Text File  |  1993-06-16  |  1KB  |  49 lines

  1. :
  2. #!/bin/sh
  3.  
  4. PATH="BINDIR:$PATH"; export PATH
  5. if test "`echo -n a`" = "-n a"; then
  6.   # looks like a SysV system:
  7.   n1=''; n2='\c'
  8. else
  9.   n1='-n'; n2=''
  10. fi
  11. oldtty=`stty -g 2>/dev/null`
  12. if stty -cbreak 2>/dev/null; then
  13.   cb='cbreak'; ncb='-cbreak'
  14. else
  15.   # 'stty min 1' resets eof to ^a on both SunOS and SysV!
  16.   cb='min 1 -icanon'; ncb='icanon eof ^d'
  17. fi
  18. if test $? -eq 0 -a -n "$oldtty"; then
  19.    trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
  20. else
  21.    trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
  22. fi
  23.  
  24. if test $# = 0; then
  25.     gzip -cdfq | eval ${PAGER-more}
  26. else
  27.     FIRST=1
  28.     for FILE
  29.     do
  30.     if test $FIRST -eq 0; then
  31.         echo $n1 "--More--(Next file: $FILE)$n2"
  32.         stty $cb -echo 2>/dev/null
  33.         ANS=`dd bs=1 count=1 2>/dev/null` 
  34.         stty $ncb echo 2>/dev/null
  35.         echo " "
  36.         if test "$ANS" = 'e' -o "$ANS" = 'q'; then
  37.             exit
  38.         fi
  39.     fi
  40.     if test "$ANS" != 's'; then
  41.         echo "------> $FILE <------"
  42.         gzip -cdfq "$FILE" | eval ${PAGER-more}
  43.     fi
  44.     if test -t; then
  45.         FIRST=0
  46.     fi
  47.     done
  48. fi
  49.